#include "MainControlPlugin.h"
#include "MainControl.h"

ModuleLinkerSPtr				global_module_linker_		= nullptr;
IQCustomplotFactorySPtr			global_custom_factory_		= nullptr;

MainControlPlugin::MainControlPlugin(QObject* parent)
	: QObject(parent) 
{

}

MainControlPlugin::~MainControlPlugin() {

}

void MainControlPlugin::InitPlugin(ModuleLinkerSPtr _context_ptr)
{
	if (!global_module_linker_)
		global_module_linker_ = _context_ptr;

	MainControlSPtr main_control_ptr = std::make_shared<MainControl>();
	global_module_linker_->SetServicePtrById(MAINCONTROLSERVICEID, main_control_ptr);
}

void MainControlPlugin::StartPlugin()
{
	if (!global_module_linker_)
		return;
	
	global_custom_factory_ = Service(IQCustomplotFactory, IQCUSTOMPLOTFACTORYSERVICEID, global_module_linker_);

	return;
}